<link rel="stylesheet" href="__PUBLICAPP__/js/jcrop/css/jquery.Jcrop.css" type="text/css" />
<script type="text/javascript" src="__PUBLICAPP__/js/jcrop/js/jquery.Jcrop.js"></script>
<style type="text/css">
	.imgbox {height: 350px;width:700px;overflow: scroll;text-align: left;}
</style>
</head>
<body>
	<div class="imgbox"><img src="{$imgurl}" name="imgurl" id="imgurl" /></div>
	<div class="clear"></div>
	<div class="btn tac">
	<form action="/index.php/admin_crop_pic/crop_image_save" method="post" name="form" id="form">
	<input name="imgurl" type="hidden" value="{$imgurl}" />
	<input type="hidden" size="4" id="x1" name="x" /> 
	<input type="hidden" size="4" id="y1" name="y" /> 
	<input type="hidden" size="4" id="x2" name="y1" /> 
	<input type="hidden" size="4" id="y2" name="y2" /> 
	<input type="hidden" size="4" id="w" name="w" /> 
	<input type="hidden" size="4" id="h" name="h" /> 
	<button class="button" type="submit" >保存</button>
	<button class="button" type="button" onclick="$.dialog.close()">关闭</button>
	</form>
	</div>
<script type="text/javascript">
$(function(){
	$("#imgurl").Jcrop({onChange:showCoords,onSelect:showCoords});
	function showCoords(obj){
		$("#x1").val(obj.x);$("#y1").val(obj.y);$("#x2").val(obj.x2);$("#y2").val(obj.y2);$("#w").val(obj.w);$("#h").val(obj.h);
	}
	$('#form').ajaxForm({
		dataType: "json",
		success: function(json) {
		if(json.result==1){//成功
		      $.dialog.top.frames['frame_content'].$('#pic').val(json.file);
			  $.dialog.top.frames['frame_content'].inslist(json);
			  $.dialog.close();
		  }else{
			  $.dialog.through({content: '裁剪失败！可能是您服务器环境限制GD库原因！',lock: true});
		 }	  
		}
	});
});
</script>